﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AdaptiveDeNet.Functions
{
    public class Schwefel : Function
    {


        public double Feval(double[] x)
        {
            double fx = 0;

            double ad = 418.9828872724338;

            double sum1 = 0;

            for (int i = 0; i < x.Length; i++)
            {
                sum1 += x[i] * Math.Sin(Math.Sqrt(Math.Abs(x[i])));    
            }

            fx = ad * x.Length - sum1;

            return fx;
        }

    }
}
